from app.models import db

class StockPrice(db.Model):
    __tablename__ = 'stock_prices'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    ticker = db.Column(db.String(10), index=True, nullable=False)  # 通常股票代码不超过10字符
    date = db.Column(db.Date, index=True, nullable=False)
    close = db.Column(db.Float, nullable=False)

    # 用于debug
    def __repr__(self):
        return f'<StockPrice {self.ticker} {self.date} {self.close}>'